//
//  JWHomePageCell.m
//  koubei
//
//  Created by 李彦宏 on 2018/5/14.
//  Copyright © 2018年 朱圳. All rights reserved.
//

#import "JWHomePageCell.h"
#define YTextColor HWColor(239, 197, 54)
@implementation JWHomePageCell

//类方法快速创建cell
+(instancetype)cellwithTableview:(UITableView *)tableview{
    
    // 1.创建cell
    static NSString *ID = @"cell";
    JWHomePageCell * cell = [tableview dequeueReusableCellWithIdentifier:ID];
    if (cell == nil) {
        cell = [[JWHomePageCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
    }
    return  cell;
    
}
/**
 *  cell的初始化方法，一个cell只会调用一次
 *  一般在这里添加所有可能显示的子控件，以及子控件的一次性设置
 */
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        //添加UI控件
        [self setcellUI];
    }
    return self;
}

- (void)setcellUI{
#pragma -mark ———————————研究生cell————————————————————
    UILabel *lb2=[[UILabel alloc] init];
    
    [lb2 setTextColor:[UIColor blackColor]];
    [lb2 setFont:[UIFont systemFontOfSize:14]];
    lb2.textAlignment=NSTextAlignmentCenter;
    lb2.text=@"史蒂芬金";
    self.Jname=lb2;
    [self.contentView addSubview:lb2];
    lb2.frame = CGRectMake(ScreenWidth-90, 7, 75, 30);
    
    UILabel *lb3=[[UILabel alloc] init];
    [lb3 setTextColor:[UIColor blackColor]];
    [lb3 setFont:[UIFont systemFontOfSize:14]];
    lb3.textAlignment=NSTextAlignmentCenter;
    lb3.text=@"史蒂芬金史蒂芬金史蒂芬金";
    self.StcollegeLb=lb3;
    [self.contentView addSubview:lb3];
    lb3.frame = CGRectMake(15, 7, ScreenWidth-105, 30);
    
    UILabel *lb6=[[UILabel alloc] init];
    [lb6 setBackgroundColor:[UIColor clearColor]];
    [lb6 setTextColor:[UIColor lightGrayColor]];
    [lb6 setFont:[UIFont systemFontOfSize:16]];
    lb6.textAlignment=NSTextAlignmentLeft;
    lb6.text=@">";
    [self.contentView addSubview:lb6];
    lb6.frame = CGRectMake(ScreenWidth-15,6 , 10, 30);
}

- (void)setSmode:(SDUserModel *)Smode{
    _Smode=Smode;

    if([_Smode.statu isEqualToString:@"0"]){
        self.Jname.textColor=[UIColor blackColor];
        self.StcollegeLb.textColor=[UIColor blackColor];
    }else if ([_Smode.statu isEqualToString:@"1"]){
        self.Jname.textColor=YTextColor;
        self.StcollegeLb.textColor=YTextColor;
    }else{
        self.Jname.textColor=[UIColor redColor];
        self.StcollegeLb.textColor=[UIColor redColor];
    }
        self.Jname.text=_Smode.jname;
    self.StcollegeLb.text=_Smode.goal;
}
- (void)awakeFromNib {
    [super awakeFromNib];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
